package org.liuqm.proxy.staticproxy;


/**
 * 买家代购
 */
public class BuyerProxy implements Buyer{

    //目标用户   真实主题
    Buyer target = null;
    public BuyerProxy(Buyer target) {
        this.target=target;
    }

    @Override
    public Object buyer() {

        System.out.println("排队");
        System.out.println("抢票");
        long startTime=System.currentTimeMillis();

        //调用被代理的方法
        Object o=target.buyer();
        long endTime=System.currentTimeMillis();
        System.out.println("买票花了"+(endTime-startTime)+"ms");
        System.out.println("取票");

        return o;

    }
}
